﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using Telerik.Windows.Controls;
using LightSwitchApplication.UserCode;

namespace LightSwitchApplication.Screens
{
    /// <summary>
    /// Interaction logic for LSWReport.xaml
    /// </summary>
    public partial class LSWReport
    {
        public LSWReport()
        {
            InitializeComponent();
            StyleManager.ApplicationTheme = new Office_BlueTheme();
            this.reportViewer.RenderBegin += new Telerik.ReportViewer.Silverlight.RenderBeginEventHandler(reportViewer_RenderBegin);

            this.reportViewer.ReportServiceUri = new Uri(Global._URLReport);
        }

        public string ReportName
        {
            get { return this.reportViewer.Report; }
            set { this.reportViewer.Report = "LSW.Wcf.App.Report." + value + ",LSW.Wcf.App"; }
        }
        public Dictionary<string, object> Parameters { get; set; }

        void reportViewer_RenderBegin(object sender, Telerik.ReportViewer.Silverlight.RenderBeginEventArgs args)
        {
            foreach (var para in this.Parameters)
            {
                args.ParameterValues[para.Key] = this.Parameters[para.Key];
            }
        }
    }
}
